package ecoll.server.quiz;

import java.util.ArrayList;

import com.google.appengine.api.datastore.Entity;

public class QuizQuestion {

	String question;
	ArrayList<String> answers;

	QuizQuestion(Entity questionEntity) {
		question = (String) questionEntity.getProperty("question");
		answers = (ArrayList<String>) questionEntity.getProperty("answers");
	}

	QuizQuestion(String question, ArrayList<String> answers) {
		this.question = question;
		this.answers = answers;
	}

	// null also returns true!!
	public boolean check(String answer) {
		if (answer == null)
			return true;
		if (answers != null && answers.contains(answer))
			return true;
		return false;
	}
}
